#include "ModuleFactory.h"



ModuleFactory::ModuleFactory()
{

}


ModuleFactory::~ModuleFactory()
{
	m_pPlatform->FreeHandle(m_dll_render);
}

_hr ModuleFactory::SetUp(EngineProperty& prop, std::shared_ptr<PlatformLayer>& pPlatform)
{
	m_pPlatform = pPlatform;
	m_dll_render = pPlatform->GetModule(prop.RenderDllPath.c_str());
	m_proc_mre = reinterpret_cast<proc_makeRenderEngine>(pPlatform->GetMathod(m_dll_render, "MakeRenderEngineDX12"));

	return _OK;
}

_hr ModuleFactory::MakeRenderEngine(std::unique_ptr<NBRenderEngine>& pRenderEngine)
{
	if (!m_proc_mre) 
	{
		return -1;//TODO: PreSet Error Code : No Func Get From Dll 
	}

	return m_proc_mre(pRenderEngine);
}
